package com.leedsoft.common;

import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.util.Date;

/**
 * DateUtil
 */
public class DateUtil {
    /**
     * 将Date进行格式化
     * @param date
     * @param patten
     * @return
     */
    public static Date formatDate (Date date ,String patten){
        SimpleDateFormat simpleDateFormat = new SimpleDateFormat(patten);
        String oldDate = simpleDateFormat.format(date);
        try {
            return simpleDateFormat.parse(oldDate);
        } catch (ParseException e) {
            e.printStackTrace();
        }finally {
            return  new Date();
        }
    }
}
